#!/bin/sh

TOMCAT_HOME="/home/appuser/tomcat"

git pull && /bin/sh ./build && $TOMCAT_HOME/bin/shutdown.sh && groovy ./deploy.groovy $TOMCAT_HOME

if [ $? -eq 0 ] 
then
  echo -n "startup tomcat?[Y/N]"
  read TMP
  if [ "$TMP" == "Y" -o "$TMP" == "y" ]
  then
    $TOMCAT_HOME/bin/startup.sh && tail -0f $TOMCAT_HOME/logs/catalina.out
  fi
fi
 
